package com.idealighter.game.server.db.datadb.mapper;

import com.idealighter.game.server.db.datadb.generate.mapper.RoomCardGroupMemberDomainMapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface RoomCardGroupMemberMapper extends RoomCardGroupMemberDomainMapper {

  @Select({ "<script>", "select ", "distinct(group_id),id", "from", "room_card_group_member",
      "where player_id = #{playerId}", "<if test='groupId!=null'>", " and group_id &lt; #{groupId}",
      "</if>", "order by group_id desc, id desc", "limit #{limit}", "</script>" })
  List<Integer> findMyGroup(@Param("playerId") long playerId, @Param("groupId") Integer groupId,
      @Param("limit") int limit);


  @Select({ "<script>", "select ", "player_avatar", "from", "room_card_group_member",
      "where group_id = #{groupId} and player_avatar is not null", "order by id", "limit 9",
      "</script>" })
  List<String> selectTop9Avatar(Integer groupId);

}
